
include(ExternalProject)
include(cmake/util.cmake)

if (ENABLE_NNDEPLOY_ONNX STREQUAL "OFF")
elseif (ENABLE_NNDEPLOY_ONNX STREQUAL "ON")
  set(LIBS onnx)
  set(ONNX_ROOT ${PROJECT_SOURCE_DIR}/third_party/onnx)
  # set(ONNX_USE_PROTOBUF_SHARED_LIBS ON CACHE BOOL ... FORCE)
  # set(ONNX_BUILD_SHARED_LIBS ON CACHE BOOL ... FORCE)
  # find_package(Protobuf REQUIRED)
  # if(Protobuf_FOUND)
  # else()
  #   set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${PROJECT_SOURCE_DIR}/build/protoc)
  # endif()
  
  if(SYSTEM.Windows)
    set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/protoc.exe)
  else()
    set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${PROJECT_SOURCE_DIR}/build/protoc)
  endif()
  set(ONNX_INSTALL_DIR ${NNDEPLOY_INSTALL_THIRD_PARTY_PATH}/onnx)
  add_subdirectory_if_no_target(${ONNX_ROOT} ${LIBS})
  include_directories(${ONNX_ROOT})
  set(NNDEPLOY_THIRD_PARTY_LIBRARY ${NNDEPLOY_THIRD_PARTY_LIBRARY} ${LIBS})
else()
endif()